package com.wiscamp.ninechapters.problems.domain.models.challenges;

import cube.ddd.domain.Entity;
import lombok.Data;

import java.util.Objects;

@Data
public class AmcSummaryReport implements Entity {
    private String reportType = "";

    private long userId;

    private long taskId;

    private int questionQty;

    private int correctQuestionQty;

    private long usedSeconds;

    private double totalScore;

    private AmcStatistic amcStatistic;

    private String scoreSummary;

    public String getScoreSummary() {
        if (Objects.isNull(this.amcStatistic))
            return "Unknown";

        double percentOnePoints = amcStatistic.getPercentOnePoints();
        double percentFivePoints = amcStatistic.getPercentFivePoints();
        double percentQuarterPoints = amcStatistic.getPercentQuarterPoints();
        double percentHalfPoints = amcStatistic.getPercentHalfPoints();
        double percentThreeQuarterPoints = amcStatistic.getPercentThreeQuarterPoints();

        if (this.totalScore >= percentOnePoints)
            return "Top 1% Score - Distinguished Honor Roll";
        else if (this.totalScore >= percentFivePoints) {
            if (!reportType.equals("AMC10"))
                return "Top 5% Score - Honor Roll";
            else
                return "Top 2.5% Score - Honor Roll";
        } else if (this.totalScore >= percentQuarterPoints)
            return "Top 25% Score";
        else if (this.totalScore >= percentHalfPoints)
            return "Top 50% Score";
        else if (this.totalScore >= percentThreeQuarterPoints)
            return "Top 75% Score";

        return "Participation";
    }


}
